﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RR407Response_v1", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR407ResponseV1))]
    public class RR407ResponseV1Serializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRR407ResponseV1 clazz;
        
        public RR407ResponseV1Serializer(IRR407ResponseV1 clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("Isikukood");
            if (clazz.Isikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikukood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Isikupnimi");
            if (clazz.Isikupnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikupnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikupnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Isikuenimi");
            if (clazz.Isikuenimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuenimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuenimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("SurmaKuup");
            if (clazz.SurmaKuup!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SurmaKuup))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SurmaKuup");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("KodakondsusKood");
            if (clazz.KodakondsusKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KodakondsusKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : KodakondsusKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("KodakondsusNimetus");
            if (clazz.KodakondsusNimetus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KodakondsusNimetus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : KodakondsusNimetus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EmakeelKood");
            if (clazz.EmakeelKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EmakeelKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EmakeelKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EmakeelNimetus");
            if (clazz.EmakeelNimetus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EmakeelNimetus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EmakeelNimetus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("RiikKood");
            if (clazz.RiikKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RiikKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : RiikKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Riik");
            if (clazz.Riik!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Riik))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Riik");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("MkKood");
            if (clazz.MkKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MkKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : MkKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Maakond");
            if (clazz.Maakond!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Maakond))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Maakond");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("ValdKood");
            if (clazz.ValdKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ValdKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ValdKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Vald");
            if (clazz.Vald!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Vald))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Vald");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("AsulaKood");
            if (clazz.AsulaKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AsulaKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : AsulaKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Asula");
            if (clazz.Asula!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Asula))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Asula");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Vaikekoht");
            if (clazz.Vaikekoht!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Vaikekoht))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Vaikekoht");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Tanav");
            if (clazz.Tanav!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tanav))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Tanav");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Nimi");
            if (clazz.Nimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Nimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Nimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Maja");
            if (clazz.Maja!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Maja))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Maja");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Korter");
            if (clazz.Korter!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Korter))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Korter");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineRiikKood");
            if (clazz.EndineRiikKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineRiikKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineRiikKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineRiik");
            if (clazz.EndineRiik!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineRiik))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineRiik");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineMkKood");
            if (clazz.EndineMkKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineMkKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineMkKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineMaakond");
            if (clazz.EndineMaakond!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineMaakond))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineMaakond");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineValdKood");
            if (clazz.EndineValdKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineValdKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineValdKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineVald");
            if (clazz.EndineVald!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineVald))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineVald");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineAsulaKood");
            if (clazz.EndineAsulaKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineAsulaKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineAsulaKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineAsula");
            if (clazz.EndineAsula!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineAsula))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineAsula");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineVaikekohaKood");
            if (clazz.EndineVaikekohaKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineVaikekohaKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineVaikekohaKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineVaikekoht");
            if (clazz.EndineVaikekoht!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineVaikekoht))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineVaikekoht");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineTanav");
            if (clazz.EndineTanav!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineTanav))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineTanav");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineNimi");
            if (clazz.EndineNimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineNimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineNimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineMaja");
            if (clazz.EndineMaja!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineMaja))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineMaja");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineKorter");
            if (clazz.EndineKorter!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineKorter))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineKorter");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineElukohtAlgus");
            if (clazz.EndineElukohtAlgus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineElukohtAlgus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineElukohtAlgus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EndineElukohtLopp");
            if (clazz.EndineElukohtLopp!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EndineElukohtLopp))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EndineElukohtLopp");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EestkosteOn");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.EestkosteOn))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("ElamislubaOn");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.ElamislubaOn))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("Veakood");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.Veakood))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("Veatekst");
            if (clazz.Veatekst!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Veatekst))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Veatekst");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="Isikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Isikukood");
                }
                clazz.Isikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Isikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Isikukood", Reader.LocalName);
            }
            if (Reader.LocalName=="Isikupnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Isikupnimi");
                }
                clazz.Isikupnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Isikupnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Isikupnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="Isikuenimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Isikuenimi");
                }
                clazz.Isikuenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Isikuenimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Isikuenimi", Reader.LocalName);
            }
            if (Reader.LocalName=="SurmaKuup") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>SurmaKuup");
                }
                clazz.SurmaKuup = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("SurmaKuup")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>SurmaKuup", Reader.LocalName);
            }
            if (Reader.LocalName=="KodakondsusKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>KodakondsusKood");
                }
                clazz.KodakondsusKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("KodakondsusKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>KodakondsusKood", Reader.LocalName);
            }
            if (Reader.LocalName=="KodakondsusNimetus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>KodakondsusNimetus");
                }
                clazz.KodakondsusNimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("KodakondsusNimetus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>KodakondsusNimetus", Reader.LocalName);
            }
            if (Reader.LocalName=="EmakeelKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EmakeelKood");
                }
                clazz.EmakeelKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EmakeelKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EmakeelKood", Reader.LocalName);
            }
            if (Reader.LocalName=="EmakeelNimetus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EmakeelNimetus");
                }
                clazz.EmakeelNimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EmakeelNimetus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EmakeelNimetus", Reader.LocalName);
            }
            if (Reader.LocalName=="RiikKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>RiikKood");
                }
                clazz.RiikKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("RiikKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>RiikKood", Reader.LocalName);
            }
            if (Reader.LocalName=="Riik") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Riik");
                }
                clazz.Riik = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Riik")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Riik", Reader.LocalName);
            }
            if (Reader.LocalName=="MkKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>MkKood");
                }
                clazz.MkKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MkKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>MkKood", Reader.LocalName);
            }
            if (Reader.LocalName=="Maakond") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Maakond");
                }
                clazz.Maakond = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Maakond")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Maakond", Reader.LocalName);
            }
            if (Reader.LocalName=="ValdKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>ValdKood");
                }
                clazz.ValdKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("ValdKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>ValdKood", Reader.LocalName);
            }
            if (Reader.LocalName=="Vald") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Vald");
                }
                clazz.Vald = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Vald")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Vald", Reader.LocalName);
            }
            if (Reader.LocalName=="AsulaKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>AsulaKood");
                }
                clazz.AsulaKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("AsulaKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>AsulaKood", Reader.LocalName);
            }
            if (Reader.LocalName=="Asula") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Asula");
                }
                clazz.Asula = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Asula")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Asula", Reader.LocalName);
            }
            if (Reader.LocalName=="Vaikekoht") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Vaikekoht");
                }
                clazz.Vaikekoht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Vaikekoht")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Vaikekoht", Reader.LocalName);
            }
            if (Reader.LocalName=="Tanav") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Tanav");
                }
                clazz.Tanav = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tanav")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Tanav", Reader.LocalName);
            }
            if (Reader.LocalName=="Nimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Nimi");
                }
                clazz.Nimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Nimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Nimi", Reader.LocalName);
            }
            if (Reader.LocalName=="Maja") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Maja");
                }
                clazz.Maja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Maja")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Maja", Reader.LocalName);
            }
            if (Reader.LocalName=="Korter") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Korter");
                }
                clazz.Korter = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Korter")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Korter", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineRiikKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineRiikKood");
                }
                clazz.EndineRiikKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineRiikKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineRiikKood", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineRiik") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineRiik");
                }
                clazz.EndineRiik = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineRiik")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineRiik", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineMkKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineMkKood");
                }
                clazz.EndineMkKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineMkKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineMkKood", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineMaakond") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineMaakond");
                }
                clazz.EndineMaakond = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineMaakond")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineMaakond", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineValdKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineValdKood");
                }
                clazz.EndineValdKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineValdKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineValdKood", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineVald") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineVald");
                }
                clazz.EndineVald = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineVald")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineVald", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineAsulaKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineAsulaKood");
                }
                clazz.EndineAsulaKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineAsulaKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineAsulaKood", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineAsula") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineAsula");
                }
                clazz.EndineAsula = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineAsula")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineAsula", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineVaikekohaKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineVaikekohaKood");
                }
                clazz.EndineVaikekohaKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineVaikekohaKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineVaikekohaKood", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineVaikekoht") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineVaikekoht");
                }
                clazz.EndineVaikekoht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineVaikekoht")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineVaikekoht", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineTanav") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineTanav");
                }
                clazz.EndineTanav = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineTanav")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineTanav", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineNimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineNimi");
                }
                clazz.EndineNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineNimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineNimi", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineMaja") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineMaja");
                }
                clazz.EndineMaja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineMaja")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineMaja", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineKorter") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineKorter");
                }
                clazz.EndineKorter = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineKorter")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineKorter", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineElukohtAlgus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineElukohtAlgus");
                }
                clazz.EndineElukohtAlgus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineElukohtAlgus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineElukohtAlgus", Reader.LocalName);
            }
            if (Reader.LocalName=="EndineElukohtLopp") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EndineElukohtLopp");
                }
                clazz.EndineElukohtLopp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EndineElukohtLopp")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EndineElukohtLopp", Reader.LocalName);
            }
            if (Reader.LocalName=="EestkosteOn") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>EestkosteOn");
                }
                clazz.EestkosteOn = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("EestkosteOn")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>EestkosteOn", Reader.LocalName);
            }
            if (Reader.LocalName=="ElamislubaOn") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>ElamislubaOn");
                }
                clazz.ElamislubaOn = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("ElamislubaOn")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>ElamislubaOn", Reader.LocalName);
            }
            if (Reader.LocalName=="Veakood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Veakood");
                }
                clazz.Veakood = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("Veakood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Veakood", Reader.LocalName);
            }
            if (Reader.LocalName=="Veatekst") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR407Response_v1>Veatekst");
                }
                clazz.Veatekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Veatekst")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR407Response_v1>Veatekst", Reader.LocalName);
            }
        }
    }
}
